package com.todofun.business.tuanke.bo;

import java.util.List;

import com.todofun.business.tuanke.vo.SubscribeUser;
import com.todofun.common.app.BaseService;
import com.todofun.common.app.MailTools;
import com.todofun.common.util.CommonUtil;

public class SubscribeUserService extends BaseService{

	public void addSubscribeUser(SubscribeUser subscribeUser) {
		saveVo(subscribeUser);
		MailTools tool = new MailTools();
		tool.sendMail("有新的用户来订阅","用户订阅Email： "+ subscribeUser.getEmail()+"\r\n订阅时间："+ CommonUtil.getCurrentTime(), "wugang021874@126.com");
	}

	public void editSubscribeUser(SubscribeUser subscribeUser) {
		updateVo(subscribeUser);
	}

	public List<SubscribeUser> listAllSubscribeUser() {
		String hql = "from SubscribeUser order by id desc";
		List<SubscribeUser> allSubscribeUser = queryByHQL(hql);
		return allSubscribeUser;
		
	}

	public SubscribeUser loadSubscribeUser(Long subscribeUserId) {
		SubscribeUser subscribeUser = (SubscribeUser)getVoByID(SubscribeUser.class, subscribeUserId);
		return subscribeUser;
	}
	
	public void delSubscribeUser(Long subscribeUserId) {
		SubscribeUser subscribeUser = (SubscribeUser)getVoByID(SubscribeUser.class,subscribeUserId);
		delVo(subscribeUser);
	}


}
